
// 用户名校验
export const validateUsername= (rule, value, callback) => {

  var uPattern = /^[(\u4e00-\u9fa5)|a-zA-Z0-9_-]{2,20}$/;

  let flag=uPattern.test(value)

  if(flag){
    callback();
  }else{
    callback("用户名小于2个字符或包含特殊符号");
  }
};

// 手机号校验
export const validateTelephone = (rule, value, callback) => {

  var uPattern = /^(0|86|17951)?(13[0-9]|15[012356789]|166|17[3678]|18[0-9]|14[57])[0-9]{8}$/;

  let flag=uPattern.test(value)

  if(flag){
    callback();
  }else{
    callback("手机号码错误");
  }
};

// 密码校验
export const validatePassword= (rule, value, callback) => {

  var uPattern = /^[^\s\u4e00-\u9fa5]{6,12}$/;

  let flag=uPattern.test(value)

  if(flag){
    callback();
  }else{
    callback("密码小于6个字符或包含空格");
  }
};

// 短信验证码校验
export const validateMsgCode = (rule, value, callback) => {

  var uPattern = /^\d{6}$/;

  let flag=uPattern.test(value)

  if(flag){
    callback();
  }else{
    callback("验证码为6位纯数字");
  }
};

// 确认密码校验
export const validateRePassword = (rule, value, callback,subValue) => {
  if (value !== subValue) {
    callback("两次输入的密码不一致");
  } else {
    callback();
  }
};

// 纳锐人识别号校验
export const validatePayCode = (rule, value, callback) => {

  var uPattern = /[0-9A-HJ-NPQRTUWXY]{2}\d{6}[0-9A-HJ-NPQRTUWXY]{10}/

  let flag=uPattern.test(value)

  if(flag){
    callback();
  }else{
    callback("纳税人识别号错误");
  }
};

// 邮政编码校验
export const validatePostCode = (rule, value, callback) => {
      var uPattern = /^\d+$/

      let flag=uPattern.test(value)

      if(flag){
        callback();
      }else{
        callback("邮政编码为6位以内纯数字");
      }
};

// 银行卡校验
export const validateBankCode = (rule, value, callback) => {
      var uPattern = /^([1-9]{1})(\d{14}|\d{18})$/

      let flag=uPattern.test(value)

      if(flag){
        callback();
      }else{
        callback("请输入正确银行卡号");
      }
};
